<?php
$lang = LANGUAGE_NONE;
//GESTIONE BUTTON SCOPRI
global $language;
$label_scopri = 'DISCOVER';
$unina = 'University of Naples "Federico II"';
if($language->language == 'it'){
	$label_scopri = 'SCOPRI';
	$unina = 'universit&agrave; "Federico II" di Napoli';	
}
?>
<!-- Galleria che compone l'header -->
<div class="galleria">
	<!-- Contenitore Elementi Galleria -->
	<div class="owl-carousel contenitore_galleria" id="owl-galleria">
<?php if(isset($node->field_gallery[$lang])): 
		$pulsanti = '';
		$cnt_g = 1;
		foreach ($node->field_gallery[$lang] as $elem):
			$galleria = field_collection_item_load($elem);
			?>						
		<div class="item elemento_galleria" id="elemento-galleria_<?php print $cnt_g;?>">
			<div class="immagine">
				<img src="<?php print file_create_url($galleria->field_image[$lang][0]['uri']); ?>" />
			</div>
			<div class="contenuto">
			<?php if(isset($galleria->field_icona[$lang])):?>						
				<div class="icona">
					<img src="<?php print file_create_url($galleria->field_icona[$lang][0]['uri']); ?>" />
				</div>
			<?php endif;?>	
				<div class="titolo">
					<?php print ($galleria->field_titolo_blk[$lang])?$galleria->field_titolo_blk[$lang][0]['value']:''; ?>
				</div>
				<div class="testo">
					<?php print ($galleria->field_desc[$lang])?$galleria->field_desc[$lang][0]['value']:''; ?>
				</div>							
			</div>
		</div>
		<?php if(($galleria->field_rifer_ct[$lang])){
				$pulsanti .= '<div class="item scopri scopri_bianco" id="scopri_galleria_'.$cnt_g.'">
					<a href="'.url('node/'.$galleria->field_rifer_ct[$lang][0]['nid']).'">'.$label_scopri.'</a>
				</div>';
			 }else{
			 	$pulsanti .= '<div class="item scopri scopri_bianco" id="scopri_galleria_'.$cnt_g.'" style="visibility: hidden;">
					<a href="#">'.$label_scopri.'</a>
				</div>';
			 }?>
		<?php  $cnt_g++;
				endforeach;
				endif;	 ?>		
	</div>
	<!-- /Contenitore  Elementi Galleria -->
	<div class="clear"></div>
	<!-- Contenitore pulsanti galleria -->
	<div class="owl-carousel contenitore_scopri" id="owl-scopri">
		<?php print $pulsanti;?>
	</div>
	<!-- /Contenitore pulsanti galleria -->
	
	<!-- Pulsantiera Galleria -->					
	<div class="pulsanti_scorrimento">
		<a class="prev"><img src="<?php print base_path().path_to_theme(); ?>/images/previous_quadrato_w.png" /></a>
		<div class="conteggio_pagina">1/2</div>
		<a class="next"><img src="<?php print base_path().path_to_theme(); ?>/images/next_quadrato_w.png" /></a>
	</div>
	<!-- /Pulsantiera Galleria -->
	
	<!-- Scelta lingua -->					
	<div class="scelta_lingua">
		<?php 
			$block = module_invoke('locale', 'block_view', 'language');
			print render($block['content']);
		?>
	</div>
	<!-- /Scelta lingua -->
	
</div>
<!-- /Galleria che compone l'header -->
<div class="clear"></div>				
<!-- Visore con la galleria divisa in 2 (immagine/testo) -->
<?php if(isset($node->field_our_projects[$lang])):?>
<div class="visore_centrale">
	<div class="owl-carousel contenitore_progetto" id="owl-progetti">
	<?php
		$cnt_p = 1;
		$cnt = 0; 
		foreach ($node->field_our_projects[$lang] as $proj):
			$project = field_collection_item_load($proj);
	?>
		<div class="item elemento_progetto" id="progetto_<?php print $cnt_p;?>"> 
			<!-- Lato SX -->
			<div class="left">
				<div class="immagine">
					<img src="<?php print file_create_url($project->field_image[$lang][0]['uri']); ?>" />
				</div>
				<div class="titolo_sezione">
					<div class="icona"><img src="<?php print base_path().path_to_theme(); ?>/images/compasso.png" /></div>
					<div class="testo"><?php print ($node->language == 'it')?'I nostri progetti':'Our projects'?></div>	
				</div>
			</div>
			<!-- /Lato SX -->
			
			<!-- Lato DX -->
			<div class="right">			
				<?php if($project->field_icona[$lang]):?>
				<div class="logo">
					<img src="<?php print file_create_url($project->field_icona[$lang][0]['uri']); ?>" />
				</div>
				<?php endif;?>						
				<div class="testo">
					<div class="titolo">
					<?php if(isset($project->field_titolo_blk[$lang])):?>
						<?php print $project->field_titolo_blk[$lang][0]['value'];?>
					<?php endif;?>
					</div>
					<div class="descrizione">
					<?php if(isset($project->field_descrizione[$lang])):?>
						<?php print $project->field_descrizione[$lang][0]['value']; ?>
					<?php endif;?>
					</div>
				</div>
				<div class="scopri">
					<a href="<?php print url('node/'.$project->field_rifer_ct[$lang][0]['nid']);?>"><?php print $label_scopri; ?></a>
				</div>
			</div>
		</div>
		<?php 	$cnt_p++;
				$cnt++;
				endforeach;?>
	</div>	
	<?php if($cnt > 1):?>						
	<div class="pulsanti_scorrimento">
		<a class="prev_progetti"><img src="<?php print base_path().path_to_theme(); ?>/images/previous_quadrato_b.png" /></a>
		<div class="conteggio_pagina">1/2</div>
		<a class="next_progetti"><img src="<?php print base_path().path_to_theme(); ?>/images/next_quadrato_b.png" /></a>
	</div>	
	<?php endif;?>
</div>
<?php endif;?>
<!-- /Lato dX -->

<!-- /Visore -->

<div class="clear"></div>

<!-- Contenitore Centrale) -->
<div class="contenuto_centrale">
<?php //Vista News HP
	  $view_news = views_get_view('news_hp');
	  $view_news->set_display('page');
	  $view_news->set_arguments(array($node->language));
	  $view_news->is_cacheable = FALSE;
	  $view_news->execute();
	  $output_news = '';
	  $class_team = 'extended';
	  if($view_news->result){
		$output_news = $view_news->preview();
		$class_team = '';
	  }
	?>
	<!-- Team -->
	<div class="team <?php print $class_team; ?>">
		<div class="contenuto">
			<div class="titolo_sezione">
				<?php if(($node->field_icona[$lang])):?>
				<div class="icona"><img src="<?php print file_create_url($node->field_icona[$lang][0]['uri']);?>" /></div>
				<?php endif;?>
				<div class="testo"><?php print ($node->field_titolo_sezione[$lang])?render($content['field_titolo_sezione']):'';?></div>	
			</div>
			<div class="clear"></div>
			<div class="logo">
				<div class="icona">
					<img src="<?php print base_path().path_to_theme(); ?>/images/logo_univ.png" />
				</div>
				<div class="testo">
					<?php print $unina; ?>
				</div>
			</div>
			<div class="clear"></div>
			<div class="testo_team">
				<div class="titolo">
					<?php print ($node->field_titolo_blk[$lang])?render($content['field_titolo_blk']):'';?>
				</div>
				<div class="clear"></div>
				<div class="descrizione">
					<?php print ($node->field_descrizione[$lang])?render($content['field_descrizione']):'';?>
				</div>
			</div>
			<?php if(isset($node->field_rifer_ct[$lang])):?>
			<div class="clear"></div>
			<div class="scopri scopri_bianco">
				<a href="<?php print url('node/'.$node->field_rifer_ct[$lang][0]['nid']);?>"><?php print $label_scopri; ?></a>
			</div>
			<?php endif;?>
		</div>
	</div>
	<!-- /Team -->
	
	<!-- News -->
	<?php print $output_news; ?>
	<!-- /News -->
	
</div>
<!-- /Visore -->